<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\select2\Select2;

/* @var $this yii\web\View */
/* @var $model backend\models\Furniture */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="create-form furniture-form">

    <?php $form = ActiveForm::begin(); ?>
    <?= $form->field($model, 'id_type')->widget(Select2::classname(), [
            'data' => \backend\models\FurnitureType::getList(),
            'options' => ['placeholder' => 'Выберете тип...'],
        ]); 
    ?>

    <?= $form->field($model, 'brand')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'imageFile')->fileInput(['accept' => 'image/*']) ?>

    <?php 
        if(!empty($model->scheme_img))
        {
            echo Html::img(
                'https://storage.yandexcloud.net/' . backend\models\Furniture::BUCKET_NAME  . '/'. $model->scheme_img, 
                $options = ['class' => 'img-thumbnail', 'style' => ['width' => '280px']]
            );
        }
    ?>

    <?= $form->field($model, 'color')->textInput(['maxlength' => true]) ?>

    <div class="row">
        <?= $form->field($model, 'dimensions_height', ['options' => ['class' => 'col-sm-4']])->textInput() ?>
        <?= $form->field($model, 'dimensions_width', ['options' => ['class' => 'col-sm-4']])->textInput() ?>
        <?= $form->field($model, 'dimensions_depth', ['options' => ['class' => 'col-sm-4']])->textInput() ?>
    </div>


    <?= $form->field($model, 'amount')->textInput() ?>

    <div class="form-group">
        <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
